<?

$con;
function connectdb() {
    $host = "localhost";
    $port = 3306;
    $socket = "";
    $user = "root";
    $password = "";
    $dbname = "tms";
    global $con;
    $con = new mysqli($host, $user, $password, $dbname, $port, $socket)
            or die('Could not connect to the database server' . mysqli_connect_error());
}
function closedb(){
    global $con;
    $con->close();
}

?>